﻿// This class is "generated" and will be overwritten.
// Your customizations should be made in Marca_gasolineraRecord.cs

using System;
using System.Collections;
using System.Data.SqlTypes;
using BaseClasses;
using BaseClasses.Data;
using BaseClasses.Data.SqlProvider;

namespace EnGasAdoAPP.Business
{

/// <summary>
/// The generated superclass for the <see cref="Marca_gasolineraRecord"></see> class.
/// </summary>
/// <remarks>
/// This class is not intended to be instantiated directly.  To obtain an instance of this class, 
/// use the methods of the <see cref="Marca_gasolineraTable"></see> class.
/// </remarks>
/// <seealso cref="Marca_gasolineraTable"></seealso>
/// <seealso cref="Marca_gasolineraRecord"></seealso>
public class BaseMarca_gasolineraRecord : PrimaryKeyRecord
{

	public readonly static Marca_gasolineraTable TableUtils = Marca_gasolineraTable.Instance;

	// Constructors
 
	protected BaseMarca_gasolineraRecord() : base(TableUtils)
	{
		this.InsertingRecord += 
			new BaseClasses.IRecordWithTriggerEvents.InsertingRecordEventHandler(this.Marca_gasolineraRecord_InsertingRecord); 
		this.UpdatingRecord += 
			new BaseClasses.IRecordWithTriggerEvents.UpdatingRecordEventHandler(this.Marca_gasolineraRecord_UpdatingRecord); 
		this.ReadRecord +=
            new BaseClasses.IRecordWithTriggerEvents.ReadRecordEventHandler(this.Marca_gasolineraRecord_ReadRecord); 
	}

	protected BaseMarca_gasolineraRecord(PrimaryKeyRecord record) : base(record, TableUtils)
	{
	}
	
	
	//Audit Trail methods
	
	//Evaluates Initialize when->Reading record formulas specified at the data access layer
    protected virtual void Marca_gasolineraRecord_ReadRecord(Object sender,System.EventArgs e)
    {
        //Apply Initialize->Reading record formula only if validation is successful.
                Marca_gasolineraRecord Marca_gasolineraRec = (Marca_gasolineraRecord)sender;
        if(Marca_gasolineraRec != null && !Marca_gasolineraRec.IsReadOnly ){
                }
    
    }
        
	//Evaluates Initialize when->Inserting formulas specified at the data access layer
    protected virtual void Marca_gasolineraRecord_InsertingRecord(Object sender,System.ComponentModel.CancelEventArgs e)
    {
        //Apply Initialize->Inserting formula only if validation is successful.
                Marca_gasolineraRecord Marca_gasolineraRec = (Marca_gasolineraRecord)sender;
        Validate_Inserting();
        if(Marca_gasolineraRec != null && !Marca_gasolineraRec.IsReadOnly ){
                }
    
    }
    
    //Evaluates Initialize when->Updating formulas specified at the data access layer
    protected virtual void Marca_gasolineraRecord_UpdatingRecord(Object sender,System.ComponentModel.CancelEventArgs e)
    {
        //Apply Initialize->Updating formula only if validation is successful.
                Marca_gasolineraRecord Marca_gasolineraRec = (Marca_gasolineraRecord)sender;
        Validate_Updating();
        if(Marca_gasolineraRec != null && !Marca_gasolineraRec.IsReadOnly ){
                }
    
    }

   //Evaluates Validate when->Inserting formulas specified at the data access layer
	protected virtual void Validate_Inserting()
	{
		string fullValidationMessage = "";
		string validationMessage = "";
		
		

		if(validationMessage != "" && validationMessage.ToLower() != "true")
            fullValidationMessage = fullValidationMessage + validationMessage + "\r\n"; 
		
        if(fullValidationMessage != "")
			throw new Exception(fullValidationMessage);
	}
 
	//Evaluates Validate when->Updating formulas specified at the data access layer
	protected virtual void Validate_Updating()
	{
		string fullValidationMessage = "";
		string validationMessage = "";
		
		

		if(validationMessage != "" && validationMessage.ToLower() != "true")
            fullValidationMessage = fullValidationMessage + validationMessage + "\r\n"; 
		
        if(fullValidationMessage != "")
			throw new Exception(fullValidationMessage);
	}
	public virtual string EvaluateFormula(string formula, BaseRecord  dataSourceForEvaluate, string format)
    {
        Data.BaseFormulaEvaluator e = new Data.BaseFormulaEvaluator();
        
        // All variables referred to in the formula are expected to be
        // properties of the DataSource.  For example, referring to
        // UnitPrice as a variable will refer to DataSource.UnitPrice
        e.DataSource = dataSourceForEvaluate;

        Object resultObj = e.Evaluate(formula);
        if(resultObj == null) 
			return "";
        return resultObj.ToString();
	}







#region "Convenience methods to get/set values of fields"

	/// <summary>
	/// This is a convenience method that provides direct access to the value of the record's Marca_gasolinera_.ID_Marca field.
	/// </summary>
	public ColumnValue GetID_MarcaValue()
	{
		return this.GetValue(TableUtils.ID_MarcaColumn);
	}

	/// <summary>
	/// This is a convenience method that provides direct access to the value of the record's Marca_gasolinera_.ID_Marca field.
	/// </summary>
	public Int32 GetID_MarcaFieldValue()
	{
		return this.GetValue(TableUtils.ID_MarcaColumn).ToInt32();
	}

	/// <summary>
	/// This is a convenience method that provides direct access to the value of the record's Marca_gasolinera_.Nombre_Marca field.
	/// </summary>
	public ColumnValue GetNombre_MarcaValue()
	{
		return this.GetValue(TableUtils.Nombre_MarcaColumn);
	}

	/// <summary>
	/// This is a convenience method that provides direct access to the value of the record's Marca_gasolinera_.Nombre_Marca field.
	/// </summary>
	public string GetNombre_MarcaFieldValue()
	{
		return this.GetValue(TableUtils.Nombre_MarcaColumn).ToString();
	}

	/// <summary>
	/// This is a convenience method that allows direct modification of the value of the record's Marca_gasolinera_.Nombre_Marca field.
	/// </summary>
	public void SetNombre_MarcaFieldValue(ColumnValue val)
	{
		this.SetValue(val, TableUtils.Nombre_MarcaColumn);
	}

	/// <summary>
	/// This is a convenience method that allows direct modification of the value of the record's Marca_gasolinera_.Nombre_Marca field.
	/// </summary>
	public void SetNombre_MarcaFieldValue(string val)
	{
		ColumnValue cv = new ColumnValue(val);
		this.SetValue(cv, TableUtils.Nombre_MarcaColumn);
	}
	/// <summary>
	/// This is a convenience method that provides direct access to the value of the record's Marca_gasolinera_.Logo field.
	/// </summary>
	public ColumnValue GetLogoValue()
	{
		return this.GetValue(TableUtils.LogoColumn);
	}

	/// <summary>
	/// This is a convenience method that provides direct access to the value of the record's Marca_gasolinera_.Logo field.
	/// </summary>
	public byte[] GetLogoFieldValue()
	{
		return this.GetValue(TableUtils.LogoColumn).ToBinary();
	}

	/// <summary>
	/// This is a convenience method that allows direct modification of the value of the record's Marca_gasolinera_.Logo field.
	/// </summary>
	public void SetLogoFieldValue(ColumnValue val)
	{
		this.SetValue(val, TableUtils.LogoColumn);
	}

	/// <summary>
	/// This is a convenience method that allows direct modification of the value of the record's Marca_gasolinera_.Logo field.
	/// </summary>
	public void SetLogoFieldValue(string val)
	{
		this.SetString(val, TableUtils.LogoColumn);
	}

	/// <summary>
	/// This is a convenience method that allows direct modification of the value of the record's Marca_gasolinera_.Logo field.
	/// </summary>
	public void SetLogoFieldValue(byte[] val)
	{
		ColumnValue cv = new ColumnValue(val);
		this.SetValue(cv, TableUtils.LogoColumn);
	}
	/// <summary>
	/// This is a convenience method that provides direct access to the value of the record's Marca_gasolinera_.Descripcion field.
	/// </summary>
	public ColumnValue GetDescripcionValue()
	{
		return this.GetValue(TableUtils.DescripcionColumn);
	}

	/// <summary>
	/// This is a convenience method that provides direct access to the value of the record's Marca_gasolinera_.Descripcion field.
	/// </summary>
	public string GetDescripcionFieldValue()
	{
		return this.GetValue(TableUtils.DescripcionColumn).ToString();
	}

	/// <summary>
	/// This is a convenience method that allows direct modification of the value of the record's Marca_gasolinera_.Descripcion field.
	/// </summary>
	public void SetDescripcionFieldValue(ColumnValue val)
	{
		this.SetValue(val, TableUtils.DescripcionColumn);
	}

	/// <summary>
	/// This is a convenience method that allows direct modification of the value of the record's Marca_gasolinera_.Descripcion field.
	/// </summary>
	public void SetDescripcionFieldValue(string val)
	{
		ColumnValue cv = new ColumnValue(val);
		this.SetValue(cv, TableUtils.DescripcionColumn);
	}


#endregion

#region "Convenience methods to get field names"

	/// <summary>
	/// This is a property that provides direct access to the value of the record's Marca_gasolinera_.ID_Marca field.
	/// </summary>
	public Int32 ID_Marca
	{
		get
		{
			return this.GetValue(TableUtils.ID_MarcaColumn).ToInt32();
		}
		set
		{
			ColumnValue cv = new ColumnValue(value);
			this.SetValue(cv, TableUtils.ID_MarcaColumn);
		}
	}


	/// <summary>
	/// This is a convenience method that can be used to determine that the column is set.
	/// </summary>
	public bool ID_MarcaSpecified
	{
		get
		{
			ColumnValue val = this.GetValue(TableUtils.ID_MarcaColumn);
            if (val == null || val.IsNull)
            {
                return false;
            }
            return true;
		}
	}

	/// <summary>
	/// This is a convenience method that allows direct modification of the value of the record's Marca_gasolinera_.ID_Marca field.
	/// </summary>
	public string ID_MarcaDefault
	{
		get
		{
			return TableUtils.ID_MarcaColumn.DefaultValue;
		}
	}
	/// <summary>
	/// This is a property that provides direct access to the value of the record's Marca_gasolinera_.Nombre_Marca field.
	/// </summary>
	public string Nombre_Marca
	{
		get
		{
			return this.GetValue(TableUtils.Nombre_MarcaColumn).ToString();
		}
		set
		{
			ColumnValue cv = new ColumnValue(value);
			this.SetValue(cv, TableUtils.Nombre_MarcaColumn);
		}
	}


	/// <summary>
	/// This is a convenience method that can be used to determine that the column is set.
	/// </summary>
	public bool Nombre_MarcaSpecified
	{
		get
		{
			ColumnValue val = this.GetValue(TableUtils.Nombre_MarcaColumn);
            if (val == null || val.IsNull)
            {
                return false;
            }
            return true;
		}
	}

	/// <summary>
	/// This is a convenience method that allows direct modification of the value of the record's Marca_gasolinera_.Nombre_Marca field.
	/// </summary>
	public string Nombre_MarcaDefault
	{
		get
		{
			return TableUtils.Nombre_MarcaColumn.DefaultValue;
		}
	}
	/// <summary>
	/// This is a property that provides direct access to the value of the record's Marca_gasolinera_.Logo field.
	/// </summary>
	public byte[] Logo
	{
		get
		{
			return this.GetValue(TableUtils.LogoColumn).ToBinary();
		}
		set
		{
			ColumnValue cv = new ColumnValue(value);
			this.SetValue(cv, TableUtils.LogoColumn);			 
		}
	}
	
	

	/// <summary>
	/// This is a convenience method that can be used to determine that the column is set.
	/// </summary>
	public bool LogoSpecified
	{
		get
		{
			ColumnValue val = this.GetValue(TableUtils.LogoColumn);
            if (val == null || val.IsNull)
            {
                return false;
            }
            return true;
		}
	}

	/// <summary>
	/// This is a convenience method that allows direct modification of the value of the record's Marca_gasolinera_.Logo field.
	/// </summary>
	public string LogoDefault
	{
		get
		{
			return TableUtils.LogoColumn.DefaultValue;
		}
	}
	/// <summary>
	/// This is a property that provides direct access to the value of the record's Marca_gasolinera_.Descripcion field.
	/// </summary>
	public string Descripcion
	{
		get
		{
			return this.GetValue(TableUtils.DescripcionColumn).ToString();
		}
		set
		{
			ColumnValue cv = new ColumnValue(value);
			this.SetValue(cv, TableUtils.DescripcionColumn);
		}
	}


	/// <summary>
	/// This is a convenience method that can be used to determine that the column is set.
	/// </summary>
	public bool DescripcionSpecified
	{
		get
		{
			ColumnValue val = this.GetValue(TableUtils.DescripcionColumn);
            if (val == null || val.IsNull)
            {
                return false;
            }
            return true;
		}
	}

	/// <summary>
	/// This is a convenience method that allows direct modification of the value of the record's Marca_gasolinera_.Descripcion field.
	/// </summary>
	public string DescripcionDefault
	{
		get
		{
			return TableUtils.DescripcionColumn.DefaultValue;
		}
	}


#endregion
}

}
